	<?php 
		$ci= &get_instance();
		$currencyCodeArray = currencyDataConfig();
		
		if( !isset($_GET['o']) OR $_GET['o'] == 'desc' )
			$o = 'asc';
		else
			$o = 'desc';
			
		$cashOrder = site_url("admin/dataman/user/listall/?s=cash&o=$o");
		$coinOrder = site_url("admin/dataman/user/listall/?s=coin&o=$o");
		$bonusOrder = site_url("admin/dataman/user/listall/?s=bonus&o=$o");
		$crdateOrder = site_url("admin/dataman/user/listall/?s=created_time&o=$o");
	?>

	<h3><?php echo ucfirst($this->uri->segment(3,''));?></h3>
	<?php $buttons = array('buttons'=>array('Add#user_add();') );?>
	<?php $this->load->view('admin/partials/buttons', $buttons ); ?>
	
	<div class="clrboth"></div>
	
	<?php $this->load->view('admin/user/search_partial' ); ?>
	<div class="clrboth"></div>
	
	<table border="0" class="table-list">
		<thead>
			<tr>
				<th>Username</th>
				<th>Email</th>
				<th>Fullname</th>
				<th>Country</th>
				<th>Signup IP</th>
				<th><a href="<?php echo $cashOrder;?>">Cash</a></th>
				<th><a href="<?php echo $coinOrder;?>">Coin</a></th>
				<th><a href="<?php echo $bonusOrder;?>">Bonus</a></th>
				<th><a href="<?php echo $crdateOrder;?>">Created date</a></th>
				<th><?php echo lang('dataman.manage'); ?></th>
			</tr>
		</thead>
		
		<tbody>
			<?php foreach( $items['items'] as $item ): ?>
			<?php 
				$USER = $ci->user_entity->init('id',$item->id);
			?>
			<tr>
				<td><?php echo $USER->getUserName(); ?></td>
				<td><?php echo $USER->getEmail(); ?></td>
				<td><?php echo $USER->getFullName(); ?></td>
				<td><?php echo $USER->getCountry(); ?></td>
				<td><?php echo $USER->getLoginIp();?></td> <!--<a href="javascript:void(0);" onclick="_shipping_info(<?php //echo $USER->getId();?>);">View</a> -->
				<td><?php echo currencyExchangeScore($USER->getCash(),$USER->getCurrencyCode())." ".$currencyCodeArray[$USER->getCurrencyCode()];?></td>
				<td><?php echo $USER->getCoin(); ?></td>
				<td><?php echo $USER->getBonus(); ?></td>
				<td><?php echo sysDateFormat($USER->getCreatedTime(),DATE_FM); ?></td>
				<td>
					<?php 
						echo form_dropdown( 'status',
											$options = array('activated'=>'Activated','deactivated'=>'Deactivated'),
											$selected = array($USER->getStatus()),
											"id='status' onchange='change_user_status(this.value,{$USER->getId()});' class='no-uniform'"
										);
					?>
					&nbsp;|&nbsp;
					<a href="javascript:void(0);" onclick="_edit(<?php echo $USER->getId();?>)"><?php echo lang('dataman.edit');?></a>
					&nbsp;|&nbsp;
					<a href="javascript:void(0);" onclick="_delete(<?php echo $USER->getId();?>)" ><?php echo lang('dataman.delete');?></a>
				</td>
			</tr>
			<?php endforeach; ?>
		</tbody>
		<tfoot>
			<tr>
				<td colspan="10">
					<div class="inner"><?php echo $items['pagination']['links']; ?></div>
				</td>
			</tr>
		</tfoot>
	</table>


